home *** CD-ROM | disk | FTP | other *** search
/ Champak 40 / Vol 40.iso / games / skates.swf / scripts / frame_213 / DoAction.as
Encoding:
Text File  |  2007-04-20  |  5.4 KB  |  216 lines

  1. if(_root.gotoIntro == 1)
  2. {
  3.    _root.gotoIntro = 0;
  4.    gotoAndPlay(197);
  5. }
  6. if(playOK == 0)
  7. {
  8.    bg1.stop();
  9.    fg.gotoAndStop(1);
  10. }
  11. if(playOK == 1)
  12. {
  13.    bg1.play();
  14.    fg.play();
  15.    if(timeSet != true)
  16.    {
  17.       timeSet = true;
  18.       obCount = 0;
  19.       timeAmm = 32 - level * 1.7;
  20.       obTime = random(timeAmm * 3) + timeAmm;
  21.    }
  22.    obCount++;
  23.    obTime >= obCount ? 0 : (obNumCount++, obOn[obNumCount] = 2, obCount = 0, timeSet = false);
  24.    obNum = 1;
  25.    while(obNum < 3)
  26.    {
  27.       if(obOn[obNum] == 2)
  28.       {
  29.          level >= 9 ? (type = 90 + random(10) + 1) : (type = 10 * (level - 1) + random(10) + 1);
  30.          this["ob" + obNum].gotoAndStop(type);
  31.          this["ob" + obNum]._x = obStartX;
  32.          this["ob" + obNum]._y = obStartY;
  33.          obOn[obNum] = 3;
  34.       }
  35.       if(obOn[obNum] == 3)
  36.       {
  37.          this["ob" + obNum]._x += Speed * 1.5;
  38.          MovW + 50 >= ob2._x ? 0 : (obNumCount = 0);
  39.          MovW + 100 >= this["ob" + obNum]._x ? 0 : (obOn[obNum] = 4);
  40.       }
  41.       if(obOn[obNum] == 4)
  42.       {
  43.          ObsJumped++;
  44.          if(15 < ObsJumped)
  45.          {
  46.             Speed = StartSpeed + SpeedCo * level;
  47.             ObsJumped = 0;
  48.             playOk = 0;
  49.             _root.timeBonus = 25;
  50.             nextLevel.gotoAndPlay(2);
  51.          }
  52.          obOn[obNum] = 0;
  53.          this["ob" + obNum]._x = -999;
  54.          !(random(2) == 1 and player.hand == false and player.jumpin == false) ? 0 : player.gotoAndPlay("kick");
  55.       }
  56.       obNum++;
  57.    }
  58.    if(obOn[33] == 0)
  59.    {
  60.       ob3.gotoAndPlay(1);
  61.       obCount3 = 0;
  62.       obTime3 = random(150) + 150;
  63.       obOn[33] = 1;
  64.    }
  65.    if(obOn[33] == 1)
  66.    {
  67.       obCount3++;
  68.       obTime3 >= obCount3 ? 0 : (obOn[33] = 2);
  69.    }
  70.    if(obOn[33] == 2)
  71.    {
  72.       obOn[33] = 3;
  73.       ob3._x = obStartX;
  74.       ob3._y = obStartY;
  75.       ranFrm = random(3) + 2;
  76.       ob3.bonus.bonusMoving.gotoAndStop(ranFrm);
  77.    }
  78.    if(obOn[33] == 3)
  79.    {
  80.       ob3._x += Speed * 1.2;
  81.       MovW + 50 >= ob3._x ? 0 : (obOn[33] = 4);
  82.    }
  83.    if(obOn[33] == 4)
  84.    {
  85.       hitBonus = false;
  86.       ob3.bonus.gotoAndStop(1);
  87.       ob3._x = -999;
  88.       obOn[33] = 0;
  89.    }
  90.    if(player.head.hitTest(ob3) == true and hitBonus != true)
  91.    {
  92.       _root.soundOn != 1 ? 0 : SFX2.gotoAndPlay(2);
  93.       musicRnd = 0;
  94.       musicRnd = random(4);
  95.       musicRnd != 0 ? 0 : (_root.tuneSnd1On = true);
  96.       musicRnd != 1 ? 0 : (_root.tuneSnd1On = false);
  97.       musicRnd != 2 ? 0 : (_root.tuneSnd2On = true);
  98.       musicRnd != 3 ? 0 : (_root.tuneSnd2On = false);
  99.       _root.bonusMove = _root.bonusMoveTemp;
  100.       if(_root.bonusMove == "kick")
  101.       {
  102.          bonuses.gotoAndStop("kick");
  103.       }
  104.       else if(_root.bonusMove == "barrel")
  105.       {
  106.          bonuses.gotoAndStop("barrel");
  107.       }
  108.       else
  109.       {
  110.          bonuses.gotoAndStop("points");
  111.          _root.gamescore += 75;
  112.       }
  113.       hitBonus = true;
  114.       ob3.bonus.gotoAndPlay(2);
  115.       _root.gamescore += 25;
  116.    }
  117.    if((ob1.hitTest(hitPx,hitPy,true) == true or ob2.hitTest(hitPx,hitPy,true) == true or ob1.hitTest(hitP2x,hitP2y,true) == true or ob2.hitTest(hitP2x,hitP2y,true) == true) and hit != true)
  118.    {
  119.       hit = true;
  120.       player.jumpin != false ? 0 : player.gotoAndPlay("fall");
  121.       player.dust.gotoAndPlay(2);
  122.       player.ouch.gotoAndPlay(2);
  123.       _root.soundOn != 1 ? 0 : SFXsmash.gotoAndPlay(2);
  124.       _root.soundOn != 1 ? 0 : SFXnoise.gotoAndStop(3);
  125.       lives.nextFrame();
  126.    }
  127.    bg1._x += Speed;
  128.    bg1._x < 900 ? 0 : (bg1._x = bg1St);
  129. }
  130. if(hit == true)
  131. {
  132.    fg.gotoAndStop(1);
  133.    Speed = - crashSp;
  134.    crashSp /= 1.2;
  135.    bg1._x >= bg1St ? 0 : (bg1._x = 900);
  136.    if(crashSp < 0.0001)
  137.    {
  138.       hit = false;
  139.       reset = true;
  140.    }
  141. }
  142. if(reset == true)
  143. {
  144.    obNumCount = 0;
  145.    player.gotoAndStop(1);
  146.    jumped = false;
  147.    setPoints = false;
  148.    reset = false;
  149.    bg1._x = bg1St;
  150.    bg2._x = bg2St;
  151.    obOn[1] = 0;
  152.    obOn[2] = 0;
  153.    obOn[33] = 0;
  154.    ob1._x = -999;
  155.    ob2._x = -999;
  156.    ob3._x = -999;
  157.    speed = StartSpeed + SpeedCo * level;
  158.    crashSp = crashSpSt;
  159. }
  160. if(_root.player._x < _root.ob1._x and _root.ob1._x < _root.player._x + 100)
  161. {
  162.    jumped = true;
  163. }
  164. if(_root.player._x < _root.ob2._x and _root.ob2._x < _root.player._x + 100)
  165. {
  166.    jumped = true;
  167. }
  168. if(setPoints == true and hit == false)
  169. {
  170.    setPoints = false;
  171.    if(jumped == true)
  172.    {
  173.       jumped = false;
  174.       jValue *= 5;
  175.    }
  176.    _root.bonusmove != "" ? 0 : bonuses.gotoAndStop("score");
  177.    _root.gamescore += jValue;
  178. }
  179. if(_root.demo == 1 and 800 < _root.gamescore)
  180. {
  181.    playOK = 0;
  182.    demoGameoverMC.gotoAndPlay(2);
  183.    gotoAndPlay(219);
  184. }
  185. if(_root.gameover == 1 and crashSp < 0.001)
  186. {
  187.    _root.soundOn != 1 ? 0 : SFXmusic.gotoAndStop(3);
  188.    _root.playOK = 0;
  189.    score = _root.gamescore;
  190.    _root.gameoverMC.gotoAndPlay(2);
  191.    _root.gotoAndPlay("end");
  192. }
  193. if(_root.soundOn == 1)
  194. {
  195.    if(_root.tuneSnd1On == true and snd1Volume < 90)
  196.    {
  197.       snd1Volume += 0.25;
  198.       Snd1.setVolume(snd1Volume);
  199.    }
  200.    if(_root.tuneSnd2On == true and snd2Volume < 90)
  201.    {
  202.       snd2Volume += 0.25;
  203.       Snd2.setVolume(snd2Volume);
  204.    }
  205.    if(_root.tuneSnd1On == false and 5 < snd1Volume)
  206.    {
  207.       snd1Volume--;
  208.       Snd1.setVolume(snd1Volume);
  209.    }
  210.    if(_root.tuneSnd2On == false and 5 < snd2Volume)
  211.    {
  212.       snd2Volume--;
  213.       Snd2.setVolume(snd2Volume);
  214.    }
  215. }
  216.